package superbird;

import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;

import javax.imageio.ImageIO;

/**
 * �ܵ���
 *
 */
public class Column {

//	public static void main(String[] args) throws IOException {
//		Column c =new Column(1);
//		int i =c.width;
//		System.out.println(i);
//	}

	 int x, y;
	 int width, height;
	 BufferedImage image;
	 int distance; // �������ӵļ�϶           ����Ӧ��Ҫ�ɱ�
	 int gap;// ������Ե����ӵľ���		����ҲӦ��Ҫ�ɱ�
	Random random = new Random();

	public Column(int n) throws IOException {
		// TODO Auto-generated constructor stub
		image = ImageIO.read(getClass().getResource("column.png"));
		width = image.getWidth();

		height = image.getHeight();
		gap = 144;
		distance = 245;

		//n��
		x = (n - 1) * distance + 550;//550?
		y = random.nextInt(218) + 132;//132? 218?

	}

	public void step() {
		x--;
		if (x <= -width / 2) {
			x = distance * 2 - width / 2;
			y = random.nextInt(218) + 132;
		}
	}

}
